FROM oven/bun:latest
WORKDIR /app

# 创建 .bunfig.toml 设置镜像加速（Docker 环境）
RUN mkdir -p /root && echo '[install]\nregistry = "https://registry.npmmirror.com/"' > /root/.bunfig.toml

# 在项目目录创建 bunfig.toml 设置镜像加速（项目目录）
RUN echo '[install]\nregistry = "https://registry.npmmirror.com/"' > /app/bunfig.toml

# Copy package files and install dependencies
COPY package*.json bun.lockb ./
COPY .env ./
COPY prisma ./prisma
RUN bun install

# Bundle app source
COPY . /app

# Set the environment variable to skip environment variable validation
ENV SKIP_ENV_VALIDATION=1

# Run the development server
CMD ["bun", "run", "dev"]

EXPOSE 3000
EXPOSE 3001